package com.designoutput.vo
{
	public class LayerTypeVo
	{
		public var name:String;
		public var type:String;
		public var shape:String;
		public var allowCustomSize:Boolean;
		public var allowBackgroundImage:Boolean;
		public var allowBackgroundColor:Boolean;
		public var sizeName:String;
		public var width:Number;
		public var height:Number;
		public var marginTop:Number;
		public var marginRight:Number;
		public var marginBottom:Number;
		public var marginLeft:Number;
		
		public static function parseFromXML(data:XML):LayerTypeVo
		{
			var obj:LayerTypeVo = new LayerTypeVo();
			
			obj.name = String(data.@name);
			obj.type = String(data.@type) || String(data.parent().@type);
			obj.shape = String(data.@shape) || String(data.parent().@shape);
			obj.allowCustomSize = (String(data.@allowCustomSize) || String(data.parent().@allowCustomSize)) == "true";
			obj.allowBackgroundImage = (String(data.@allowBackgroundImage) || String(data.parent().@allowBackgroundImage)) == "true";
			obj.allowBackgroundColor = (String(data.@allowBackgroundColor) || String(data.parent().@allowBackgroundColor)) == "true";
			obj.sizeName = String(data.@sizeName) || String(data.parent().@sizeName);
			
			obj.width = Number(data.@w) || Number(data.parent().@w);
			obj.height = Number(data.@h) || Number(data.parent().@h);
			
			obj.marginTop = Number(data.@marginTop) || Number(data.parent().@marginTop);
			obj.marginRight = Number(data.@marginRight) || Number(data.parent().@marginRight);
			obj.marginBottom = Number(data.@marginBottom) || Number(data.parent().@marginBottom);
			obj.marginLeft = Number(data.@marginLeft) || Number(data.parent().@marginLeft);
			
			return obj;
		}
	}
}